import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:old_shop/common/const/cosnt.dart';
import 'package:old_shop/page/mine/page/view/mine_cell.dart';

class MinePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Stack(
      children: [
        Positioned(
          left: 0,
          right: 0,
          top: 0,
          child: Container(
            height: 220,
            decoration: BoxDecoration(
              gradient: LinearGradient(
                  colors: [const Color(0xff976F1C), const Color(0xffE5C75A)],
                  begin: Alignment.centerLeft,
                  end: Alignment.centerRight),
            ),
            child: SafeArea(
              bottom: false,
              child: Container(
                padding: const EdgeInsets.all(16),
                child: Row(
                  children: [
                    PhysicalModel(
                      color: Colors.transparent,
                      clipBehavior: Clip.antiAlias,
                      shape: BoxShape.circle,
                      child: CachedNetworkImage(
                        imageUrl: 'https://picsum.photos/200/300',
                        width: 80,
                        height: 80,
                        fit: BoxFit.cover,
                        placeholder: (_, __) => Container(
                          color: Colors.grey,
                        ),
                      ),
                    ),
                    const SizedBox(width: 12),
                    Column(
                      mainAxisSize: MainAxisSize.min,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Text(
                          "我的",
                          style: AppFont.textStyle(18, color: Colors.white),
                        ),
                        const SizedBox(height: 4),
                        Text(
                          "这个人很懒,什么都没写~",
                          style: TextStyle(color: Colors.white),
                        )
                      ],
                    ),
                  ],
                ),
              ),
            ),
          ),
        ),
        Positioned.fill(
          top: 200,
          child: Container(
            decoration: BoxDecoration(
                color: const Color(0xfff2f2f2), borderRadius: BorderRadius.vertical(top: Radius.circular(16))),
            child: SingleChildScrollView(
              child: Column(
                children: [
                  MineCellView(
                    titles: ["我的钱包", "我的优惠券"],
                    imgs: [Icons.wallet, Icons.card_giftcard],
                  ),
                  MineCellView(
                    titles: [
                      "我的浏览",
                      "我的收藏",
                      "我的客服",
                      "设置",
                    ],
                    imgs: [
                      Icons.remove_red_eye_rounded,
                      Icons.heart_broken_sharp,
                      Icons.dashboard_customize_sharp,
                      Icons.settings_applications,
                    ],
                  ),
                  InkWell(
                    onTap: () => Navigator.pushNamedAndRemoveUntil(context, '/login', (route) => false),
                    child: Container(
                      width: double.infinity,
                      height: 36,
                      margin: const EdgeInsets.only(top: 100, left: 16, right: 16),
                      alignment: Alignment.center,
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(30),
                        border: Border.all(color: AppColor.mainColor, width: 1),
                        color: AppColor.mainColor,
                      ),
                      child: Text(
                        "退出登录",
                        style: AppFont.textStyle(14, color: Colors.white),
                      ),
                    ),
                  )
                ],
              ),
            ),
          ),
        )
      ],
    ));
  }
}
